#!/usr/bin/env python3

import subprocess

# 要检查的服务列表
services = ['httpd', 'ssh', 'mysql']

for service in services:
    # 使用systemctl命令查询服务状态
    status = subprocess.run(['systemctl', 'is-active', service], capture_output=True, text=True).stdout.strip()

    if status == 'active':
        print(service + " is running.")
    else:
        print(service + " is not running.")